﻿'*******************************************************************************************
'* Copyright Brügmann Software GmbH, Papenburg
'* Author: Björn Kremer
'* Contact: codeplex<at>patorg.de
'* 
'* VB.CMIS is a VB.NET implementation of the Content Management Interoperability Services (CMIS) standard
'*
'* This file is part of VB.CMIS.
'* 
'* VB.CMIS is free software: you can redistribute it and/or modify
'* it under the terms of the GNU Lesser General Public License as published by
'* the Free Software Foundation, either version 3 of the License, or
'* (at your option) any later version.
'* 
'* VB.CMIS is distributed in the hope that it will be useful,
'* but WITHOUT ANY WARRANTY; without even the implied warranty of
'* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'* GNU Lesser General Public License for more details.
'* 
'* You should have received a copy of the GNU Lesser General Public License
'* along with VB.CMIS. If not, see <http://www.gnu.org/licenses/>.
'*******************************************************************************************
Imports System.Xml.Serialization
Imports System.Runtime.Serialization

Namespace PropertyDefinitions

   <XmlRoot("propertyDateTimeDefinition", Namespace:=CmisNamespaceConstants.Cmis)>
   Public Class PropertyDateTimeDefinition
      Inherits PropertyDefinition(Of DateTimeOffset)

      Public Property Resolution As ResolutionEnum = ResolutionEnum.Date

      Public Sub New(id As String, localName As String, localNamespace As String, displayName As String, queryName As String, required As Boolean, inherited As Boolean, queryable As Boolean, orderable As Boolean, cardinality As Enums.Cardinality, updatability As Enums.Updatability)
         MyBase.New(id, localName, localNamespace, displayName, queryName, required, inherited, queryable, orderable, cardinality, updatability)
      End Sub

      Public Sub New()
         MyBase.New()
      End Sub

      Public Enum ResolutionEnum
         <EnumMember(Value:="year")> _
         Year
         <EnumMember(Value:="date")> _
         [Date]
         <EnumMember(Value:="time")> _
         Time
      End Enum
      Public Overrides Sub AddSpecialElements(writer As System.Xml.XmlWriter)
         Dim ns As String = CmisNamespaceConstants.Cmis
         writer.WriteElementString("resolution", ns, Common.GetDataMemberValueFromEnum(Me.Resolution, GetType(ResolutionEnum)))
      End Sub
      Public Overrides ReadOnly Property PropertyTypeName As String
         Get
            Return "datetime"
         End Get
      End Property
   End Class

End Namespace